//
//  MDHSexImageView.swift
//  JSTech
//
//  Created by 高得华 on 2019/9/4.
//  Copyright © 2020 华&梅. All rights reserved.
//

import UIKit


///性别 视图
class MDHSexImageView: UIImageView {
    @objc convenience init() {
        self.init(frame: CGRect.zero)
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.contentMode = .scaleAspectFit
    }
    override init(image: UIImage?, highlightedImage: UIImage?) {
        super.init(image: image, highlightedImage: highlightedImage)
        self.contentMode = .scaleAspectFit
    }
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        self.contentMode = .scaleAspectFit
    }
    ///1：男 2：女  3、0：保密
    @objc var sex: Int = 0 {
        didSet {
            ///性别
            switch sex {//1：男 2：女  3：保密
            case 1:
                self.image = UIImage(named: "sex_gender_man")
                break
            case 2:
                self.image = UIImage(named: "sex_gender_woman")
                break
            case 3, 0:
                self.image = UIImage(named: "sex_gender_woman")//?.byTintColor(UIColor.black.withAlphaComponent(0.8))
                break
            default:
                break
            }
        }
    }
}
